package com.freak.neteasecloudmusic.modules.mine.fragment.adapter;

import android.content.Context;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.freak.neteasecloudmusic.R;
import com.freak.neteasecloudmusic.modules.mine.entity.MinePlayListEntity;

import java.util.List;

public class MySongListAdapter extends BaseMultiItemQuickAdapter<MultiItemEntity, BaseViewHolder> {
    private Context context;
    public final static int ITEM_ADD = 1;
    public final static int ITEM_CONTEXT = 0;

    public MySongListAdapter(List<MultiItemEntity> data, Context context) {
        super(data);
        this.context = context;
        addItemType(ITEM_ADD, R.layout.item_mine_my_song_list_add);
        addItemType(ITEM_CONTEXT, R.layout.item_mine_my_song_list);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, MultiItemEntity item) {
        switch (helper.getItemViewType()) {
            case ITEM_ADD:

                break;
            case ITEM_CONTEXT:
                MinePlayListEntity.PlaylistBean playlistBean = (MinePlayListEntity.PlaylistBean) item;
                helper.setText(R.id.textViewItemSongListContext, playlistBean.getName());
                helper.setText(R.id.textViewItemSongListSongCount, playlistBean.getTrackCount()+"首");
                Glide.with(context).load(playlistBean.getCoverImgUrl()).thumbnail(0.1f).into((ImageView) helper.getView(R.id.circularBeadClipPathImageViewItemSongList));
                break;
        }
    }
}
